From: Jasper St. Pierre Date: Sun, 16 Sep 2012 17:54:25 +0000 (-0300) Subject: autorunManager: Don't try to scan remote filesystems X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5678 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0ad739e78b9342e91af9e0947808ce2627215232;p=gnome-shell.git autorunManager: Don't try to scan remote filesystems Content-Type scanning can be super expensive. The autorun manager is meant for local filesystems that are plugged into a USB port or similar, not remote NFS or sshfs mounts. https://bugzilla.gnome.org/show_bug.cgi?id=684093 --- diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js index 495063e38..5490df5b3 100644 --- a/js/ui/components/autorunManager.js +++ b/js/ui/components/autorunManager.js @@ -44,6 +44,19 @@ function isMountRootHidden(root) { return (path.indexOf('/.') != -1); } +function isMountNonLocal(mount) { + // If the mount doesn't have an associated volume, that means it could + // be a remote filesystem. For certain kinds of local filesystems, + // like digital cameras and music players, there's no associated + // gvfs volume, so err on the side of caution and assume it's a local + // filesystem to allow the prompt. + let volume = mount.get_volume(); + if (volume == null) + return false; + + return (volume.get_identifier("class") == "network"); +} + function startAppForMount(app, mount) { let files = []; let root = mount.get_root(); @@ -88,8 +101,9 @@ const ContentTypeDiscoverer = new Lang.Class({ guessContentTypes: function(mount) { let autorunEnabled = !this._settings.get_boolean(SETTING_DISABLE_AUTORUN); + let shouldScan = autorunEnabled && !isMountNonLocal(mount); - if (autorunEnabled) { + if (shouldScan) { // guess mount's content types using GIO mount.guess_content_type(false, null, Lang.bind(this,